package com.cn.wanxi.service;

import com.cn.wanxi.dao.NewsDao;
import com.cn.wanxi.model.NewsModel;

import java.util.ArrayList;
import java.util.List;

public class NewsService {
    public List<NewsModel> getNewsModelList() {
        List<NewsModel> list = new ArrayList<>();
        NewsDao newsDao = new NewsDao();

        for (int i = 0; i < newsDao.titles.length; i++) {
            NewsModel newsModel = new NewsModel();
            newsModel.setTitle(newsDao.titles[i]);
            newsModel.setContent(newsDao.contents[i]);
            list.add(newsModel);
        }
        return list;
    }
}
